package light.head.model.inv;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 往来单位信息
 * @author yy
 *
 */
@Entity
@Table
public class InvBusiness implements Serializable{
	private static final long serialVersionUID = 5186026164090625665L;
	private Integer code;							// 流水号
	private String sid;								// 往来单位编号
	private String name;							// 往来单位名称
	private String phone;							// 联系电话
	private String address;							// 地址
	private String email;							// 邮箱号
	private String fax;								// 传真
	private Integer stc;							// 往来单位类型编号
	private Integer cu;								// 创建人
	private Date ct;								// 创建时间
	private Integer oc;								// 机构编号
	private Boolean deleted = false;				// 是否删除
	private Byte type;								// (1.供应商 2.客户3.两者皆是4.其他)
	private String remake;							// 备注
	//@Formula
	private String cn;								// 创建人
	private String on;								// 机构名称
	private String stn;								// 类别名称
	private List<InvBusinessContacts> itemList;		//联系人集合
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getSid() {
		return sid;
	}
	@Column
	public String getName() {
		return name;
	}
	@Column
	public String getPhone() {
		return phone;
	}
	@Column
	public String getAddress() {
		return address;
	}
	@Column
	public String getEmail() {
		return email;
	}
	@Column
	public String getFax() {
		return fax;
	}
	@Column
	public Integer getStc() {
		return stc;
	}
	@Column(updatable = false)
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Byte getType() {
		return type;
	}
	@Column
	public String getRemake() {
		return remake;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu )")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc )")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT s.name FROM InvBusinessType s WHERE s.code = stc )")
	public String getStn() {
		return stn;
	}
	@Transient
	public List<InvBusinessContacts> getItemList() {
		return itemList;
	}
	
	
	
	
	
	public void setRemake(String remake) {
		this.remake = remake;
	}
	public void setItemList(List<InvBusinessContacts> itemList) {
		this.itemList = itemList;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setStn(String stn) {
		this.stn = stn;
	}
	public void setType(Byte type) {
		this.type = type;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setSid(String sid) {
		this.sid = sid;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public void setStc(Integer stc) {
		this.stc = stc;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	
	
	
	
}
